package exam;

/**
 * Tests the answer to the first loop question.
 * The text of the question is as follows:
 * "Write an iterative method that calculates the largest integral power of 2 less than or equal to 
 *  the parameter int.  For example, maxPowerOfTwo(5) should return 4.  Assume that the parameter 
 *  will always be a positive non-zero integer."
 * 
 * @author Branden Ogata
 *
 */

public class TestLoopA00 extends Tester
{
  public static void main(String[] args)
  {
    final double points = getPoints(args);
    
    LoopA00 question = new LoopA00();
    System.out.println(test(Category.EQUALS, "maxPowerOfTwo(1):", 0, 
                            question.maxPowerOfTwo(1), percentageToPoints(FIFTH, points)));
    System.out.println(test(Category.EQUALS, "maxPowerOfTwo(2):", 1, 
                            question.maxPowerOfTwo(2), percentageToPoints(FIFTH, points)));
    System.out.println(test(Category.EQUALS, "maxPowerOfTwo(7):", 2, 
                            question.maxPowerOfTwo(7), percentageToPoints(FIFTH, points)));
    System.out.println(test(Category.EQUALS, "maxPowerOfTwo(8):", 3, 
                            question.maxPowerOfTwo(8), percentageToPoints(FIFTH, points)));
    System.out.println(test(Category.EQUALS, "maxPowerOfTwo(9):", 3, 
                            question.maxPowerOfTwo(9), percentageToPoints(FIFTH, points)));

    System.out.format("[%.2f/%.2f]%n", getTotalPoints(), points);
  }
}
